
This document should show the first steps with QuarterBukkit. If you want to read the complete tutorial, go on http://github.com/QuarterCode/QuarterBukkit/wiki.

The Download Package
====================

If you didn't download the package from http://dev.bukkit.org/server-mods/quarterbukkit, you may downloaded a fake (maybe with viruses).

You should get the following files:

| File              | Description                                                 |
|-------------------|-------------------------------------------------------------|
| Read Me.txr       | This ReadMe info file                                       |
| QuarterBukkit.jar | The main jar (put this into your classpath)                 |
| /Changelog        | The complere QuarterBukkit changelog, seperated in files    |
| /Integration      | You have to use this classes for the integration, see below |
| /Source           | The Source-Code                                             |
| /JavaDoc          | The API Documentation with JavaDoc (you'll need this!)      |
| /Build            | All compiled classes                                        |

Integrate QuarterBukkit into your plugin
========================================

First, you have to add the QuarterBukkit.jar to the Build-Path as you did it with the bukkit.jar or craftbukkit.jar.
In Eclipse, you right-click on your project > Build Path > Add External Archives... and choose the QuarterBukkit.jar.

If you want to view the source and JavaDoc in your IDE, you have to add this to your Build-Path, too. In Eclipse, you right-click on your project > Build Path > Configure Build Path..., switch
to the Tab "Libraries" and pull down the menu for QuarterBukkit.jar. There you double-click on "Source attachement" where you can choose the Sources-Folder ("Sources" in the Download-Package)
and double-click on "Javadoc location" where you can choose the JavaDoc-Folder ("JavaDoc" in the Download-Package).

Simply put all classes from /Integration into a package of your plugin (I would use a util-package) and call QuarterBukkitIntegration.integrate() in your onEnable()-method. The method returns
if the integration was sucessfully, so if your plugin doesn't work with QuarterBukkit, you can disable it and exit the method.

Example:

    @Override
    public void onEnable() {
    
        if (!QuarterBukkitIntegration.integrate()) {
            Bukkit.getLogger().severe("Can't enable plugin " + getName() + "! For more information, see above.");
            Bukkit.getPluginManager().disablePlugin(this);
            return;
        }
    
        // Your code here
    }

Then add QuarterBukkit to your softdepend-list in the plugin.yml. If you don't have this entry, simply add this line:

    softdepend: [QuarterBukkit]

And you're done! Now you can use all amazing QuarterBukkit-functions! See JavaDoc (Download Package) and [API-Page](API Overview) for more information.

Use QuarterBukkit in your main class
====================================

If you want to use QuarterBukkit in your main class, remember one thing: Don't import/use any QuarterBukkit class or method anywhere in your main class. You cannot import something from QuarterCode
before using QuarterBukkitIntegration! That will cause NoClassDefFoundErrors because QuarterBukkit isn't installed yet!

We recommend to use a class like Enabler and put the enabling code there. Then you can call the extern enabling method from your main class.
Keep in mind: Always check your plugins for this issue!
